package com.cda.mall.dao;

import com.cda.mall.entity.Category;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.cda.mall.entity.CategoryVO;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * <p>
 * 商品分类 Mapper 接口
 * </p>
 *
 * @author cda
 * @since 2021-11-13
 */
@Repository
public interface CategoryMapper extends BaseMapper<Category> {

    //1.连接查询    :此方法只查询一次，弊端：查询层级被指定
    public List<CategoryVO> selectAllCategories();

    //2.子查询:根据parentId查询子分类 ：此方法查询多次，有多少层级都可以查询
    public List<CategoryVO> selectAllCategories2(int parentId);

    //3.查询一级类别
    public List<CategoryVO> selectFirstLevelCategories();

}
